<script type="text/javascript"><!--//--><![CDATA[//><!--
    
    $(document).ready(function() {
       // Setup Datagrid
		$('#datagrid').datagrid({ 
			url:gs_path+'/'+controller+'/getdata', 
			queryParams: $('#fm_search').serializeObject(),
			height:450,
			pagination:true,
			//singleSelect:true,
			columns:[[
				{ field : 'ck', checkbox:true, width: 40, align: 'center' },
				{ field : 'kode_perangkat', title : 'Kode Perangkat', width : 150, sortable:true },
				{ field : 'kode_barang', title : 'Kode Barang', width : 150, sortable:true },
				{ field : 'nama_barang', title : 'Nama Barang', width : 150, sortable:true },
				{ field : 'nama_merek', title : 'Nama Merek', width : 150, sortable:true },
				{ field : 'spesifikasi', title : 'Spesifikasi', width : 250,  sortable:true },
				{ field : 'kondisi', title : 'Kondisi Barang', width : 120, sortable:true },
				{ field : 'tipe', title : 'Tipe', width : 80, sortable:true },
				{ field : 'jenis_kebutuhan', title : 'Jenis Kebutuhan', width : 120, sortable:true },
				{ field : 'harga', title : 'Harga', width : 200, align:'right', sortable:true },
				{ field : 'jumlah', title : 'Jumlah', width : 200, align:'right',sortable:true },
				{ field : 'keterangan', title : 'Keterangan', width : 250, sortable:true },
			]]
		});
        
        // Set Action Button
        var buttons = [ 
						{ label: 'Add', icon: 'add', onclick: function() {
							loadPage(gs_path + '/' + controller + '/create/');
                        }},
                        // ----- >> Edit Button
					    { label: 'Edit', icon: 'edit', onclick: function() {
					        var oSel = $('#datagrid').datagrid('getSelected');
					        if (oSel == null) {
					            $.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
					        } else {
								loadPage(gs_path + '/' + controller + '/edit/?id_perangkat='+urlencode(oSel.id_perangkat)+'&& id_cabang='+urlencode(oSel.id_cabang)+'&& nama_cabang='+urlencode(oSel.nama_cabang));
					        } 
					    }},
						 // ----- >> Delete Button
						{label: 'Delete', icon: 'delete', onclick: function() { 
							var oSel = $('#datagrid').datagrid('getSelected'); 
							if (oSel == null) { 
								$.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
							} else { 
								deleteData(['id_perangkat']);
							} 
						}},
						// ----- >> Download Button
						
						// ----- >> SP Button
					    ];
        setAction(buttons);
		
		
		$('#fm_search').focusFirst();
    });
//--><!]]></script>

    
<div id="tb" style="padding:5px;height:auto">
    <div>
        <form id="fm_search" onsubmit="grid_reload(); return false;">
        	<table class="tb_form" style="margin-bottom:0px">
            <tr>
            	<td width="100">Keyword</td>
                <td><input type="text" id="keyword" name="keyword" class="textfield medium" />
                	<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="grid_reload(); return false;">Search</a>
                    <a href="#" class="easyui-linkbutton" iconCls="icon-blank-file" onclick="$('#fm_search').resetForm(); return false;">Reset</a>
                </td>
            </tr>
            </table>
        </form>
    </div>
</div>
<div id="datagrid" toolbar="#tb"></div>